<HTML><HEAD><TITLE>sum_weight(?Svar, ?Var)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(conjunto)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>sum_weight(?Svar, ?Var)</H1>
Svar is a weighted set domain variable or a weighted ground set and Var a
free variable or a domain variable or an integer which represents the
weight of Svar.


<DL>
<DT><EM>?Svar</EM></DT>
<DD>A weighted set domain variable or a weighted ground set.
</DD>
<DT><EM>?Var</EM></DT>
<DD>Term unifying with a domain variable or an integer.
</DD>
</DL>
<H2>Description</H2>
   Svar is a weighted set domain variable or ground set.  Var is the weight
   of Svar.  If Var is a free variable, this constraint is a mean to access
   a set weight and attach it to Var.  If not, the weight of Svar is
   constrained to be equal to Var.  The constraint is delayed and activated
   each time a modification occurs in the domain of Svar or Var.
   Convenient when dealing with packing problems.

<P>

<H3>Fail Conditions</H3>
   Fails if Svar is not a weighted set term or if Var can not represent the
   weight of Svar.


<H3>Resatisfiable</H3>
   No.
<H2>Examples</H2>
<PRE>
[eclipse 4]: S `:: {e(a,10), e(b,15)} ..{e(a,10), e(b,15),
                    e(c,20)}, sum_weight(S, W).

S = S{{e(a, 10), e(b, 15)} .. {e(a, 10), e(b, 15), e(c, 20)}}
W = W{[25..45]}

Delayed goals:
        weight_s(S{{e(a, 10), e(b, 15)} .. {e(a, 10),
                   e(b, 15), e(c, 20)}}, W{[25..45]})
yes.



</PRE>
<H2>See Also</H2>
<A HREF="../../lib/conjunto/BNN-2.html">`:: / 2</A>
</BODY></HTML>
